<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<div class="content-wrap">
    <div class="wrapper" style="bottom: 50px;">
        <ul class="nav nav-tabs">
            <li class="active">
                <a href="#" >调整高低限</a>
            </li>
        </ul>
        <section class="panel panel-default">
            <div class="panel-body">
                <div class="col-lg-12">
                    <form:form id="inputForm" data-parsley-validate="" modelAttribute="drugStorageProfile" onsubmit="return formSaveLoad('mainCenterDiv','inputForm','${ctx}/drug/drugStorageProfile/save','${ctx}/drug/drugStorageProfile/findMinMaxList');" method="post" class="form-horizontal">
                        <form:hidden path="id"/>
                        <form:hidden path="infoId"/>
                        <form:hidden path="drugCode"/>
                        <form:hidden path="storageId"/>
                        <div class="form-group">
                            <label class="col-sm-4 control-label">药品名称：</label>
                            <div class="col-sm-6">
                                <form:input path="drugName" htmlEscape="false" class="form-control"  maxlength="32" readonly="true" />
                            </div>
                        </div>


                        <div class="form-group">
                            <label class="col-sm-4 control-label">包装规格：</label>
                            <div class="col-sm-6">
                                <form:input path="packageSpec" htmlEscape="false" class="form-control"  maxlength="20" readonly="true" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-4 control-label">包装单位：</label>
                            <div class="col-sm-6">
                                <form:select path="packageUnits" id="packageUnits" class="form-control" data-parsley-required="true" disabled="true">
                                    <form:option value="" label="" />
                                    <form:options items="${fns:getDictList('SPEC_UNIT')}" itemLabel="label" itemValue="value" htmlEscape="false" />
                                </form:select>
                                <%--<form:input path="packageUnits" htmlEscape="false" class="form-control"  maxlength="2"  readonly="true"/>--%>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-4 control-label">大包装库存数：</label>
                            <div class="col-sm-6">
                                <form:input path="quantity" htmlEscape="false" class="form-control"  maxlength="8" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-4 control-label">大包装消耗量：</label>
                            <div class="col-sm-6">
                                <form:input path="outQuantity" htmlEscape="false" class="form-control"  maxlength="8" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-4 control-label">最低大包装数：</label>
                            <div class="col-sm-6">
                                <form:input id="minQuantity" path="minQuantity" htmlEscape="false" class="form-control"  maxlength="8" />
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-4 control-label">最高大包装数：</label>
                            <div class="col-sm-6">
                                <form:input  id="maxQuantity" path="maxQuantity" htmlEscape="false" class="form-control"  maxlength="8" />
                            </div>
                        </div>
                        <%--<div class="form-group">--%>
                            <%--<label class="col-sm-4 control-label">最小规格：</label>--%>
                            <%--<div class="col-sm-6">--%>
                                <%--<form:input path="minSpec" htmlEscape="false" class="form-control"  maxlength="20" />--%>
                            <%--</div>--%>
                        <%--</div>--%>
                        <%--<div class="form-group">--%>
                            <%--<label class="col-sm-4 control-label">最小单位：</label>--%>
                            <%--<div class="col-sm-6">--%>
                                <%--<form:input path="minUnits" htmlEscape="false" class="form-control"  maxlength="2" />--%>
                            <%--</div>--%>
                        <%--</div>--%>
                        <%--<div class="form-group">--%>
                            <%--<label class="col-sm-4 control-label">申请包装数量：</label>--%>
                            <%--<div class="col-sm-6">--%>
                                <%--<form:input path="quantity" htmlEscape="false" class="form-control"  maxlength="8" />--%>
                            <%--</div>--%>
                        <%--</div>--%>
                        <%--<div class="form-group">--%>
                            <%--<label class="col-sm-4 control-label">已发放包装数量：</label>--%>
                            <%--<div class="col-sm-6">--%>
                                <%--<form:input path="quantityOut" htmlEscape="false" class="form-control"  maxlength="8" />--%>
                            <%--</div>--%>
                        <%--</div>--%>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存">&nbsp;
                                <input id="btnCancel" class="btn" type="button" value="返 回" onclick="loadDiv('mainCenterDiv','${ctx}/drug/drugStorageProfile/findMinMaxList')">
                            </div>
                        </div>
                    </form:form>
                </div>

            </div>
        </section>
    </div>
</div>
<script>
    $(function(){
        $("#maxQuantity").change(function(){
            minAndMaxJudge();
        })
    })
    function minAndMaxJudge(){
        if($("#maxQuantity").val()!=''){
            if(parseFloat($("#maxQuantity").val())<parseFloat($("#minQuantity").val())){
                toastr.error("最高大包装数应大于最低大包装数");
                return false;
            }
            else{
                return true;
            }
        }

    }
    function formSaveLoad(divId, formId, url, hrefUrl) {
            if ($('#' + formId).parsley().validate()&&minAndMaxJudge()) {
                setTimeout(formSaveMethod(divId, formId, url, hrefUrl), 300);
            }
        return false;
    }
</script>